package com.xinfan.io.reader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @Author xin
 * @Date 2022/6/8 16:27
 * @Version 1.0
 */
public class FileReader_ {
    public static void main(String[] args) {

        String src = "G:\\桌面\\test.txt";
        char[] data = new char[1024];
        int len = 0;
        FileReader fileReader = null;

        try {
            fileReader = new FileReader(src);
            while ((len = fileReader.read(data)) != -1) {
                System.out.print(new String(data,0,len));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }
}
